package com.example.roadship;

import java.util.ArrayList;

import android.R.string;
import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import android.widget.LinearLayout.LayoutParams;

public class FriendListAdapter extends BaseAdapter {

	private ArrayList<String> ids,names,bundles;
	private Context mContext;
	
	public FriendListAdapter(Context context ,ArrayList<String> names , ArrayList<String> ids) {
		super();
		this.names = names;
		this.ids = ids;
		this.mContext = context;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return names.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}
	
	private static class ViewHolder
	{
		TextView message;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		
		ViewHolder holder; 
		if(convertView == null)
		{
			holder = new ViewHolder();
			convertView = LayoutInflater.from(mContext).inflate(R.layout.sms_row, parent, false);
			holder.message = (TextView) convertView.findViewById(R.id.message_text);
			convertView.setTag(holder);
		}
		else
			holder = (ViewHolder) convertView.getTag();
		
		
		
		LayoutParams lp = (LayoutParams) holder.message.getLayoutParams();
		
		/*holder.message.setText(messages.get(position));
		
		if(ids.get(position).equals(receiverId)){
			holder.message.setBackgroundResource(R.drawable.speech_bubble_green);
			lp.gravity = Gravity.RIGHT;
		}else {
			holder.message.setBackgroundResource(R.drawable.speech_bubble_orange);
			lp.gravity = Gravity.LEFT;
		}*/

		return convertView;
	}

}
